package com.sos.ui
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class SolveOverlay extends MovieClip 
	{
		// -------------------------------------------------------------------------------
		// CONSTANTS
		// -------------------------------------------------------------------------------
		
		// Property names
		
		// -------------------------------------------------------------------------------
		// FIELDS
		// -------------------------------------------------------------------------------
		
		private var isVisible:Boolean = false;
		
		// -------------------------------------------------------------------------------
		// CONSTRUCTORS
		// -------------------------------------------------------------------------------
		
		public function SolveOverlay()
		{
			//visible = false;
			solveText.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScroll); 
			solveText.addEventListener(MouseEvent.MOUSE_UP, mouseUpScroll); 
			logToggle.addEventListener(MouseEvent.CLICK, toggle);
		}
		
		// -------------------------------------------------------------------------------
		// PROPERTIES
		// -------------------------------------------------------------------------------	
		
		
		
		// -------------------------------------------------------------------------------
		// PRIVATE METHODS
		// -------------------------------------------------------------------------------
		
		private function mouseDownScroll(event:MouseEvent):void 
        { 
            solveText.scrollV++; 
        }
		
		private function mouseUpScroll(event:MouseEvent):void 
        { 
            solveText.scrollV--; 
        }
		
		// -------------------------------------------------------------------------------
		// PUBLIC METHODS
		// -------------------------------------------------------------------------------
		
		public function toggle(event:MouseEvent):void {
			if (isVisible)
				slideOut();
			else
				slideIn();
		}
		
		public function slideIn() {
			y = 600;
			isVisible = true;
			//visible = true;
		}
		
		public function slideOut() {
			y = 785;
			isVisible = false;
			//visible = false;
		}
		
		public function addLogRow(msg:String):void {
			solveText.htmlText += msg;
			solveText.scrollV = solveText.maxScrollV;
		}
	}
}